// index.js
// const audioCtx = wx.createWebAudioContext();
// 密码:4788d3a90d26750db1563c8dd06a2317
// 账号:wx07232632572fed5d


const api = require("../../api/index")
Page({
//放数据
data:{
  cdList:[
      {"cdName":"五角大楼场地","money":"20/h"},
      {"cdName":"东安湖场地","money":"20/h"},
      {"cdName":"兴隆湖场地","money":"20/h"}
    ]
  },
onReady(){
  api.getMsg().then(date=>
    console.log(date)
    );
},

onShow(){
  wx.request({
    url:'http://192.168.0.14/site/getSiteInfo',
    success:(date)=>{
      console.log(date.date.date);
      this.setUpdatePerformanceListener({
        cdList:date.date.date
      });
    }
  })
},

  // onReady(){
  //   console.log("页面准备好了")
  //   this.loadAudio('https://m704.music.126.net/20250328230831/6fd550166066a27f3d2ad51116ce5f06/jdyyaac/obj/w5rDlsOJwrLDjj7CmsOj/14096413111/5e41/9871/b73e/2c85a93334d89c29c8165bcf7884237e.m4a?vuutv=H3t8zZHCJD2c1R7ENv7FVDPuJM/Ys+OtK5CCj6cu7MGos9XuFpSmQUVnDKemT1+aoNhiw/hxPv8TwADrxKbAcpD0z5x6QV7L303KpLZhhkg=&authSecret=00000195dd3548e019bc0a3085041c52').then(buffer => {
  //     let source = audioCtx.createBufferSource()
  //     source.buffer = buffer
  //     source.connect(audioCtx.destination)
  //     source.start()
  //   }).catch(() => {
  //     console.log('fail')
  //   })
  // },
  // loadAudio(url){
  //   return new Promise((resolve) => {
  //     wx.request({
  //       url,
  //       responseType: 'arraybuffer',
  //       success: res => {
  //         console.log('res.data', res.data)
  //         audioCtx.decodeAudioData(res.data, buffer => {
  //           resolve(buffer)
  //         }, err => {
  //           console.error('decodeAudioData fail', err)
  //           reject()
  //         })
  //       },
  //       fail: res => {
  //         console.error('request fail', res)
  //         reject()
  //       }
  //     })
  //   })
  // },
  showMsg(){
    console.log("你好");
    wx.vibrateLong();
  },
  custom(){
    wx.openCustomerServiceChat({
      corpId:'corpId',
      extInfo:{
        url:'url',
      },
    })
  },
  jumpTo(){
    wx.navigateTo({
      url: '/secondary_page/venue_details/venue_details',
    })
  }  
})
